<script>
var dopeisongliang='__URL__/dopeisongliang';
var dobeiliao='__URL__/dobeiliao';
var dojieshubeiliao='__URL__/dojieshubeiliao';
var dologinout='__APP__/Usr/dologinout';
var pid=0;
var docheckpsstatandaddvolume='__URL__/docheckpsstatandaddvolume';
</script>
<!--table部分-->
<div class='col-md-12 col-xs-12'>

  <div class="panel panel-default">
    <div class="panel-body">
      <div class='col-md-2'><a class='btn btn-info' href='__URL__/yijianpeisong'>一键配送</a></div>
      <div class='col-md-2'>配送：{$usross['usrnn']}</div>
      <div class='col-md-2'>包材类型：{$parttypenmset}</div>
      <div class='col-md-2'>时间：{$tm}</div>
      <div class='col-md-2'>班次：{$bancio['bancinm']}</div>
      <div class='col-md-2'><a class='btn btn-info' href='__URL__/gailan'>概览</a></div>
    </div>
  </div>

  

  <style type="text/css">
  .success{background-color: #5cb85c}.warning{background-color: #f0ad4e}.danger{background-color: #c9302c}
  .danger_circle{background-color: #c9302c;border-radius: 50%}
  .success_circle{background-color: #5cb85c;border-radius: 50%}
  .warning_circle{background-color: #f0ad4e;border-radius: 50%}
  </style>
  <script type="text/javascript">
  var max={$max};
  var count={$count};
  var slot=1;
  var width_mao=Math.floor(97/count);
  var width=width_mao-slot;
  width=window.screen.width*width/100;
  slot=window.screen.width*slot/100;
  var label_height=20;

  //计算屏幕高度
  var height=window.screen.height*1/3;
  
  </script>
<!--style="text-align:center;display:table-cell;vertical-align:bottom"-->
  <div id='overroll' style="background-color:#fff;">
    <div class='pull-left slot' style="background-color:#fff;background-color:#fff" >&nbsp;</div>
  <?php foreach($psls as $psv){ ?>
    <?php 
    $xbtm=$psv['psleavetm'];
    if($xbtm>60){ $xbtm=60; }
    ?>
    <?php $zhu=$xbtm/$max;$kong=1-$zhu; ?>
    <script type="text/javascript">
    var zhu=height*{$zhu}+'px';var kong=height*{$kong}+'px';
    </script>
    <div class="pull-left zhu" style="text-align:center;">
      <div id='kong_{$psv[psid]}' ></div>
      <div style="text-align:center;color:#000;height:25px"><h4 style="margin-top:0px;margin-bottom:0px">{$psv[partnm_c]}</h4></div>
      <div class='lbl' style="padding-bottom:5px">{$psv['xianbiantm']}</div>
      <div id='zhu_{$psv[psid]}' class='{$psv[yuzhistat]}' style="border-bottom:1px solid #ccc;">&nbsp;</div>
      <div>{$psv['linenm']}</div>
      <div class="<?php echo $psv['yuzhistat'].'_circle' ?> yuan"></div>
      <div><?php if(!strstr($psv['psid'], 'line')){ ?><a  href='__URL__/single_peisonging/psid/{$psv[psid]}' <?php if($psv['f_ps_psstatid']==4){ ?>disabled class='btn btn-default'<?php }else{ ?>class='btn btn-success'<?php } ?>  >配送</a><?php } ?></div>
      <div style='margin-top:10px'><?php if(!strstr($psv['psid'], 'line')){ ?><a class='btn btn-info' onclick="ask({$psv[psid]},{$psv[partvolumeperpa]})">完成</a><?php } ?></div>
    </div>
    <div class='pull-left slot' style="background-color:#fff;background-color:#fff">&nbsp;</div>
    <script type="text/javascript">$('#kong_{$psv[psid]}').height(kong);$('#zhu_{$psv[psid]}').height(zhu);</script>
  <?php } ?>
  </div>
  <script type="text/javascript">$('#overroll').height(height+label_height+40);$('.zhu').width(width);$('.slot').width(slot);$('.slot').height(height);$('.lbl').height(label_height);$('.yuan').width(width*0.6);$('.yuan').height(width*0.6);$('.yuan').css('margin',width*0.2)</script>
  
  
</div>

<div class='col-md-2 col-xs-2'><a class='btn btn-warning' href='#' onclick="loginout()"><i class='glyphicon glyphicon-off'></i> 注销</a></div>

<script type="text/javascript">
// function complete(psid,partvolumeperpa){
//   var obj=new Object();
//   obj['psid']=psid;
//   obj['peisongliang']=partvolumeperpa;
//   $.ajax({
//       'type': 'GET',
//       'url':docheckpsstatandaddvolume,
//       'async':false,  
//       'contentType': 'application/json',
//       'data': obj,
//       'dataType': 'json',
//       'success': function(data) {
//         window.location.href='__URL__/query';
//         console.log("success");
//       },
//       'error':function() {
//           console.log("error");
//       }
//   });
// }

function loginout(){
  $.ajax({
      'type': 'GET',
      'url':dologinout,
      'async':false,  
      'contentType': 'application/json',
      'data': {},
      'dataType': 'json',
      'success': function(data) {
        
        window.location.reload();
      },
      'error':function() {
          console.log("error");
      }
  });
}
</script>


<!--#################-->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal_ask" style='display: none' id='ask'>
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal" id="myModal_ask" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" style='padding-top:100px'>
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close close_ask" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title">请输入数量</h4>
    </div>
      <div class="modal-body" id='askcontent'>
        
      <div class="form-group">
        <input type="hidden" class="form-control" id="psid" >
        <input type="telephone" class="form-control" id="peisongliang" >
      </div>
      
      <button type="submit" class="btn btn-success pull-right" id='querenwancheng'>确认完成</button>
      <div class='clearfix'></div>
    
        
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default close_ask" data-dismiss="modal" >关闭</button>
        
      </div>
    </div>
  </div>
</div>

<script>
var close_flag=0;//0的时候关闭就是关闭没有废话，1的时候关闭就是先关闭再刷新
function ask(psid,partvolumeperpa){
  $('#psid').val(psid);
  $('#peisongliang').val(partvolumeperpa);
  $('#ask').trigger('click');
  
  
}

$(function(){
  $('#querenwancheng').click(function(){
    var obj=new Object();
    obj['psid']=$('#psid').val();
    obj['peisongliang']=$('#peisongliang').val();
    $.ajax({
            'type': 'GET',
            'url':docheckpsstatandaddvolume,
            'async':false,  
            'contentType': 'application/json',
            'data': obj,
            'dataType': 'json',
            'success': function(data) {
              window.location.reload();
              console.log("success");
            },
            'error':function() {
                console.log("error");
            }
        });
  })
})

</script>

<script type="text/javascript">
var int=self.setInterval("window.location.reload()",60000);

</script>